/*
 * (C) Copyright 2016 Ymatou (http://www.ymatou.com/).
 * 
 * All rights reserved.
 */
package com.ymatou.iapi.trading.operate.parameter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import com.ymatou.iapi.trading.operate.parameter.enums.OrderTypeEnum;

/**
 * @author tuwenjie 2016年5月7日 下午4:46:32
 *
 */
public class OrderVo extends PrintFriendliness {

	private static final Long serialVersionUID = -4856453107059071845L;

	// 订单类型
	private OrderTypeEnum orderType;

	// 是否是商户
	private boolean merchant;

	// 留言
	private String leaveWord;

	// 运费
	private BigDecimal freight;

	// 是否全额付款
	private boolean paidFull;

	// 收获地址
	private String address;

	// 收获地址邮编
	private String postCode;

	// 收件人姓名
	private String receiveName;

	// 收件人手机号
	private String phone;

	// 收件人电话
	private String telephone;

	// 自动取消小时数(说明：下单后在规定时间未付款，订单自动取消)
	private BigDecimal autoCancelOrderHours;

	// 订单里的商品项
	private List<OrderItemVo> orderItems;

	/**
	 * 电商件 false:个人件, true:电商件
	 */
	private boolean ecommerceFlag;

	//是否是预售订单
	private boolean preSale;

	public boolean isPreSale() {
		return preSale;
	}

	public void setPreSale(boolean preSale) {
		this.preSale = preSale;
	}

	public OrderTypeEnum getOrderType() {
		return orderType;
	}

	public void setOrderType(OrderTypeEnum orderType) {
		this.orderType = orderType;
	}

	public boolean getMerchant() {
		return merchant;
	}

	public void setMerchant(boolean merchant) {
		this.merchant = merchant;
	}

	public String getLeaveWord() {
		return leaveWord;
	}

	public void setLeaveWord(String leaveWord) {
		this.leaveWord = leaveWord;
	}

	public BigDecimal getFreight() {

		return orderItems.stream().map(OrderItemVo::getFreight)
				.reduce(BigDecimal::add).get();

	}
	public void setFreight(BigDecimal freight) {
		this.freight = freight;
	}

	public boolean getPaidFull() {
		return paidFull;
	}

	public void setPaidFull(boolean paidFull) {
		this.paidFull = paidFull;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPostCode() {
		return postCode;
	}

	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}

	public String getReceiveName() {
		return receiveName;
	}

	public void setReceiveName(String receiveName) {
		this.receiveName = receiveName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public BigDecimal getAutoCancelOrderHours() {
		return autoCancelOrderHours;
	}

	public void setAutoCancelOrderHours(BigDecimal autoCancelOrderHours) {
		this.autoCancelOrderHours = autoCancelOrderHours;
	}

	public List<OrderItemVo> getOrderItems() {
		return orderItems;
	}

	public void setOrderItems(List<OrderItemVo> orderItems) {
		this.orderItems = orderItems;
	}

	// 以下参数用来校验数据用，跟该接口请求协议无关

	// 该订单使用的商家优惠券码
	private String sellerCouponCode;

	// 该订单分摊到的商家优惠券面值
	private BigDecimal sellerCouponValue = BigDecimal.ZERO;

	// 该订单使用的平台优惠券码
	private String ymatouCouponCode = null;

	// 该订单分摊到的平台优惠券面值
	private BigDecimal ymatouCouponValue = BigDecimal.ZERO;

	// 总原价
	private BigDecimal totalOriginalPrice = BigDecimal.ZERO;

	// 完成订单，用户应该支付的金额
	private BigDecimal needPayAmount = BigDecimal.ZERO;

	// 总成交价
	private BigDecimal totalProductPrice = BigDecimal.ZERO;

	// 总定金
	private BigDecimal totalEarnestPrice = BigDecimal.ZERO;

	// 使用了商家优惠券的总成交价
	private BigDecimal totalProductPriceInSellerCoupon = BigDecimal.ZERO;

	// 订单里各订单项关于运费的权重
	private List<BigDecimal> orderItemWeightsOnFreight = new ArrayList<BigDecimal>();

	// 订单里各订单项关于商家优惠券的权重
	private List<BigDecimal> orderItemWeightsOnSellerCoupon = new ArrayList<BigDecimal>();

	// 订单里各订单项关于平台优惠券的权重
	private List<BigDecimal> orderItemWeightsOnYmatouCoupon = new ArrayList<BigDecimal>();

	// 分摊到订单上的商家优惠金额
	private BigDecimal sellerPromotionAmount = BigDecimal.ZERO;;

	// 分摊到订单上的预付款金额
	private BigDecimal prepaidAmount = BigDecimal.ZERO;

	public BigDecimal getSellerPromotionAmount() {
		return sellerPromotionAmount;
	}

	public void setSellerPromotionAmount(BigDecimal sellerPromotionAmount) {
		this.sellerPromotionAmount = sellerPromotionAmount;
	}

	public String getSellerCouponCode() {
		return sellerCouponCode;
	}

	public void setSellerCouponCode(String sellerCouponCode) {
		this.sellerCouponCode = sellerCouponCode;
	}

	public BigDecimal getSellerCouponValue() {
		return sellerCouponValue;
	}

	public void setSellerCouponValue(BigDecimal sellerCouponValue) {
		this.sellerCouponValue = sellerCouponValue;
	}

	public String getYmatouCouponCode() {
		return ymatouCouponCode;
	}

	public void setYmatouCouponCode(String ymatouCouponCode) {
		this.ymatouCouponCode = ymatouCouponCode;
	}

	public BigDecimal getYmatouCouponValue() {
		return ymatouCouponValue;
	}

	public void setYmatouCouponValue(BigDecimal ymatouCouponValue) {
		this.ymatouCouponValue = ymatouCouponValue;
	}

	public BigDecimal getTotalOriginalPrice() {
		return totalOriginalPrice;
	}

	public void setTotalOriginalPrice(BigDecimal totalOriginalPrice) {
		this.totalOriginalPrice = totalOriginalPrice;
	}

	public BigDecimal getNeedPayAmount() {
		return needPayAmount;
	}

	public void setNeedPayAmount(BigDecimal needPayAmount) {
		this.needPayAmount = needPayAmount;
	}

	public BigDecimal getTotalProductPrice() {
		return totalProductPrice;
	}

	public void setTotalProductPrice(BigDecimal totalProductPrice) {
		this.totalProductPrice = totalProductPrice;
	}

	public BigDecimal getTotalEarnestPrice() {
		return totalEarnestPrice;
	}

	public void setTotalEarnestPrice(BigDecimal totalEarnestPrice) {
		this.totalEarnestPrice = totalEarnestPrice;
	}

	public BigDecimal getTotalProductPriceInSellerCoupon() {
		return totalProductPriceInSellerCoupon;
	}

	public void setTotalProductPriceInSellerCoupon(
			BigDecimal totalProductPriceInSellerCoupon) {
		this.totalProductPriceInSellerCoupon = totalProductPriceInSellerCoupon;
	}

	public List<BigDecimal> getOrderItemWeightsOnFreight() {
		return orderItemWeightsOnFreight;
	}

	public void setOrderItemWeightsOnFreight(
			List<BigDecimal> orderItemWeightsOnFreight) {
		this.orderItemWeightsOnFreight = orderItemWeightsOnFreight;
	}

	public List<BigDecimal> getOrderItemWeightsOnSellerCoupon() {
		return orderItemWeightsOnSellerCoupon;
	}

	public void setOrderItemWeightsOnSellerCoupon(
			List<BigDecimal> orderItemWeightsOnSellerCoupon) {
		this.orderItemWeightsOnSellerCoupon = orderItemWeightsOnSellerCoupon;
	}

	public List<BigDecimal> getOrderItemWeightsOnYmatouCoupon() {
		return orderItemWeightsOnYmatouCoupon;
	}

	public void setOrderItemWeightsOnYmatouCoupon(
			List<BigDecimal> orderItemWeightsOnYmatouCoupon) {
		this.orderItemWeightsOnYmatouCoupon = orderItemWeightsOnYmatouCoupon;
	}

	public boolean getEcommerceFlag() {
		return ecommerceFlag;
	}

	public void setEcommerceFlag(boolean ecommerceFlag) {
		this.ecommerceFlag = ecommerceFlag;
	}

	public BigDecimal getPrepaidAmount() {
		return prepaidAmount;
	}

	public void setPrepaidAmount(BigDecimal prepaidAmount) {
		this.prepaidAmount = prepaidAmount;
	}

}
